package com.fansaikj.erp.domain;

/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import javax.persistence.*;

import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_erupt.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(
        name = "编码规则",
        power = @Power(add = true, delete = true,
                edit = true, query = true, viewDetails = true,
                importable = true, export = true)
)
@Table(name = "sys_sn_rule")
@Entity
@Data
public class SnRule extends BaseModel {

    @EruptField(
            views = @View(
                    title = "主键ID", show = false
            ),
            edit = @Edit(
                    title = "主键ID",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @EruptField(
            views = @View(
                    title = "前缀",
                    width = "80px"
            ),
            edit = @Edit(
                    title = "前缀",
                    search = @Search,
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String prefix;

    @EruptField(
            views = @View(
                    title = "规则编号"
            ),
            edit = @Edit(
                    title = "规则编号",
                    search = @Search,
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String ruleCode;

    @EruptField(
            views = @View(
                    title = "正则表达式（针对年月日等情况）"
            ),
            edit = @Edit(
                    title = "正则表达式（针对年月日等情况）",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(value = "yyyy", label = "yyyy"),
                                    @VL(value = "yyyyMM", label = "yyyyMM"),
                                    @VL(value = "yyyyMMdd", label = "yyyyMMdd"),
                            }
                    )
            )
    )
    private String pattern;

    @EruptField(
            views = @View(
                    title = "数字长度"
            ),
            edit = @Edit(
                    title = "数字长度",
                    type = EditType.NUMBER, notNull = true,
                    numberType = @NumberType
            )
    )
    private Integer numLength;

    @EruptField(
            views = @View(
                    title = "创建者", show = false
            ),
            edit = @Edit(
                    title = "创建者",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建时间", show = false
            ),
            edit = @Edit(
                    title = "创建时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "更新者", show = false
            ),
            edit = @Edit(
                    title = "更新者",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "更新时间", show = false
            ),
            edit = @Edit(
                    title = "更新时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "备注"
            ),
            edit = @Edit(
                    title = "备注",
                    type = EditType.TEXTAREA
            )
    )
    private String remark;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}
